package com.gdkm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gdkm.po.Doctor;
import com.gdkm.po.Student;
import com.gdkm.service.DoctorService;

@Controller

public class DoctorController {
	@Autowired
	DoctorService service;
	
	
	@RequestMapping("/doctor")
	public String ss() {
		return "doctor";
		
	}
	
	
	@ResponseBody
	@RequestMapping("/list2")
	public List get(int y) {
		List<Doctor> list2 = service.list2((y-1)*8, 8);
		System.out.println(list2.toString());
		return list2;
	}
	@RequestMapping("/dsave")
	public String save(String doctor_name, String doctor_sex) {
		service.save1(doctor_name, doctor_sex);
		return "doctor";
		
	}
	
	@ResponseBody
	@RequestMapping("/dlist")
	public List get(String doctor_name,String doctor_sex,int y) {
		 
		List<Doctor> list = service.list3(doctor_name, doctor_sex,(y-1)*8, 8);
		System.out.println("模糊"+list);
		return list;
	}
	@RequestMapping("/ddel")
	public String del(int id) {
		service.delete1(id);
		return "doctor";
	}
	//更新
	@RequestMapping("/dupdate")
    public String update(Doctor stu){
        service.update(stu);
        System.out.print(stu);
        return  "doctor";
}

}
